#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: v2_api_body.py 
@version:
@time: 2021/12/31 
"""
from TapClientCore.T03_api_body_templates.api_body_base import *

__all__ = [
    'DATASOURCE_HTTP_CUSTOM',
    'DATASOURCE_HTTP_KAFKA',
    'DATASOURCE_HTTP_MQ',
    'DATASOURCE_WS_CUSTOMER_TEST',

    'DATAFLOW_CREATE',
    'DATAFLOW_SETTING',
    'DATAFLOW_SYNC_POINTS',
    'DATAFLOW_STAGE_SOURCE_NODE',
    'DATAFLOW_STAGE_TARGET_NODE',
    'DATAFLOW_DATA_SOURCE_MODEL',

    'TASK_CREATE_DATA_COPY',
    'TASK_CREATE_DATA_COPY_ATTRS',
    'TASK_CREATE_DATA_COPY_ATTRS_ATTRS_TASK_SOURCE_DATA',
    'TASK_CREATE_DATA_COPY_ATTRS_ATTRS_TASK_SETTING_DATA',
    'TASK_CREATE_DATA_COPY_DAG',
    'TASK_CREATE_DATA_COPY_DAG_EDGES',
    'TASK_CREATE_DATA_COPY_DAG_NODE_SOURCE',
    'TASK_CREATE_DATA_COPY_DAG_NODE_TARGET',

    'TASK_CREATE_DATA_SYNC',
    'TASK_CREATE_DATA_SYNC_DAG_EDGES',
    'TASK_CREATE_DATA_SYNC_ATTRS_ATTRS_TASK_SETTING_DATA',
    'TASK_CREATE_DATA_SYNC_DAG',
    'TASK_CREATE_DATA_SYNC_DAG_NODE_SOURCE',
    'TASK_CREATE_DATA_SYNC_DAG_NODE_TARGET',

    'TASK_MEASUREMENT',

    'META_FIND_INSPECT',
    'INSPECTS_CREATE',
    'INSPECTS_TASK',
    'INSPECTS_TASK_NODE'
]
# 功能路径
DATASOURCE = 'datasource'

DATAFLOW = 'dataflow'

TASK = 'task'

META_INSTANCE = 'metainstance'

INSPECTS = 'inspects'
# DATASOURCE

# http
DATASOURCE_HTTP_CUSTOM = read_json(path_joint(V2, DATASOURCE, 'http', 'custom.json'))
DATASOURCE_HTTP_KAFKA = read_json(path_joint(V2, DATASOURCE, 'http', 'kafka.json'))
DATASOURCE_HTTP_MQ = read_json(path_joint(V2, DATASOURCE, 'http', 'MQ.json'))

# websockets
DATASOURCE_WS_CUSTOMER_TEST = read_json(path_joint(V2, DATASOURCE, 'ws', 'testConnection.json'))
DATASOURCE_WS_PDK_TEST = read_json(path_joint(V2, DATASOURCE, 'ws', 'testConnectionPDK.json'))

# ---- DataFlows ----

# -- CREATE --

DATAFLOW_CREATE = read_json(path_joint(V2, DATAFLOW, 'dataflow.json'))

DATAFLOW_STAGE_SOURCE_NODE = read_json((path_joint(V2, DATAFLOW, 'stages', 'source_node.json')))
DATAFLOW_STAGE_TARGET_NODE = read_json((path_joint(V2, DATAFLOW, 'stages', 'target_node.json')))

DATAFLOW_SETTING = read_json(path_joint(V2, DATAFLOW, 'setting', 'setting.json'))
DATAFLOW_SYNC_POINTS = read_json(path_joint(V2, DATAFLOW, 'syncPoints', 'syncPoints.json'))

DATAFLOW_DATA_SOURCE_MODEL = read_json(path_joint(V2, DATAFLOW, 'dataSourceModel', 'dataSourceModel.json'))

# ---- TASK -----

# -- dataCopy --
TASK_CREATE_DATA_COPY = read_json(path_joint(V2, TASK, 'dataCopy', 'data_copy.json'))

# - attr -
TASK_CREATE_DATA_COPY_ATTRS = read_json(path_joint(V2, TASK, 'dataCopy', 'attr', 'data_copy_attr.json'))
TASK_CREATE_DATA_COPY_ATTRS_ATTRS_TASK_SOURCE_DATA = read_json(
    path_joint(V2, TASK, 'dataCopy', 'attr', 'attrs', 'task_data_source_data.json')
)
TASK_CREATE_DATA_COPY_ATTRS_ATTRS_TASK_SETTING_DATA = read_json(
    path_joint(V2, TASK, 'dataCopy', 'attr', 'attrs', 'task_setting_data.json')
)
# - dag -
TASK_CREATE_DATA_COPY_DAG = read_json(
    path_joint(V2, TASK, 'dataCopy', 'dag', 'data_copy_dag.json')
)
TASK_CREATE_DATA_COPY_DAG_EDGES = read_json(
    path_joint(V2, TASK, 'dataCopy', 'dag', 'edges', 'data_copy_edges.json')
)
# - data copy node -
TASK_CREATE_DATA_COPY_DAG_NODE_SOURCE = read_json(
    path_joint(V2, TASK, 'dataCopy', 'dag', 'node', 'data_copy_source.json')
)
TASK_CREATE_DATA_COPY_DAG_NODE_TARGET = read_json(
    path_joint(V2, TASK, 'dataCopy', 'dag', 'node', 'data_copy_target.json')
)

# ------ DataSync -------

# -- dataSync --
TASK_CREATE_DATA_SYNC = read_json(path_joint(V2, TASK, 'dataSync', 'data_sync.json'))

# - dag -
TASK_CREATE_DATA_SYNC_DAG = read_json(
    path_joint(V2, TASK, 'dataSync', 'dag', 'data_sync_dag.json')
)
TASK_CREATE_DATA_SYNC_DAG_EDGES = read_json(
    path_joint(V2, TASK, 'dataSync', 'dag', 'edges', 'data_sync_edges.json')
)
# setting
TASK_CREATE_DATA_SYNC_ATTRS_ATTRS_TASK_SETTING_DATA = read_json(
    path_joint(V2, TASK, 'dataSync', 'dag', 'data_sync_setting.json')
)

# - data sync node -
TASK_CREATE_DATA_SYNC_DAG_NODE_SOURCE = read_json(
    path_joint(V2, TASK, 'dataSync', 'dag', 'node', 'data_sync_source.json')
)
TASK_CREATE_DATA_SYNC_DAG_NODE_TARGET = read_json(
    path_joint(V2, TASK, 'dataSync', 'dag', 'node', 'data_sync_target.json')
)

# Task MeasureMent
TASK_MEASUREMENT = read_json(
    path_joint(V2, TASK, 'measurement', 'payload.json')
)

# META
META_FIND_INSPECT = read_json(
    path_joint(V2, META_INSTANCE, 'find_inspect.json')
)

# Inspects
INSPECTS_CREATE = read_json(
    path_joint(V2, INSPECTS, 'inspects.json')
)
INSPECTS_TASK = read_json(
    path_joint(V2, INSPECTS, 'tasks', 'inspect_task.json')
)
INSPECTS_TASK_NODE = read_json(
    path_joint(V2, INSPECTS, 'tasks', 'inspect_task_node.json')
)
if __name__ == '__main__':
    print(INSPECTS_CREATE)
